﻿using dreamwork.pay.api.Model.Data;
using Dreamwork.Core.Infrastructure.RDSDb;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace dreamwork.pay.api.Services
{
	public class PayServices : IPayServices
	{
		private readonly IRDSRepository<Provider, Guid> _providerRepository; 
		private readonly IRDSRepository<PayUser, Guid> _userRepository; 
		public PayServices(IRDSRepository<Provider, Guid> providerRepository, IRDSRepository<PayUser, Guid> userRepository)
		{
			_providerRepository = providerRepository;
			_userRepository = userRepository;
		}
		public async Task AddUserAsync()
		{
			await _userRepository.AddAsync(new PayUser() { Name = "Jerry" });
		}
		public async Task<PayUser> GetUserAsync()
		{
			var items = await _userRepository.GetAllAsync();
			return items.FirstOrDefault();
		}
		public async Task UpdateUserAsync(PayUser model)
		{
			await _userRepository.UpdateAsync(model);
		}
	}
}
